home *** CD-ROM | disk | FTP | other *** search
- /****** axuucp/rn-update *****************************************************
- *
- * NAME
- * rn-update - Update Newsgroup's .lowest & .next files
- *
- * SYNOPSIS
- * rx rn-update.rexx
- *
- * DESCRIPTION
- * For each group listed in /usr/spool/news/NewsGroups the .lowest and
- * .next file will be updated. This is useful when using external
- * spooler for AXsh news such as "tin -Sc".
- *
- * AUTHOR
- * Tobias Ferber <tf@ganymed.hall.sub.org>
- *
- ******************************************************************************
- *
- */
-
- axnews = axconfig("news")
- newsgroups = axconfig("newsgroupfile")
- tempfile = "t:rn-update." || pragma('Id')
-
- call open('fp',newsgroups)
-
- do until eof('fp')
- gname= word(readln('fp'),1)
- if words(gname) > 0 then do
- gdir= axnews || translate(gname,'/','.')
- address command 'list files dir' gdir 'lformat "%8n" pat "~(.#?)" >' tempfile
- address command 'rx "setclip(''a'',''`wc -w <' tempfile'`'')"'
- a= strip(getclip('a'),'b',d2c(9)); /*say a 'artile(s) in' gname*/
- if a>0 then do
- address command 'sort from' tempfile 'to' tempfile
- address command 'eval 0+`head -1' tempfile '` >' gdir'/.lowest'
- address command 'eval 1+`tail -1' tempfile '` >' gdir'/.next'
- end
- end
- end
-
- call close('fp')
- address command 'delete quiet' tempfile
- exit
-
- /*@<axconfig>*/
-
- /* get an AXsh configuration value */
-
- axconfig: procedure
- tempfile = "T:axconfig." || pragma('Id')
- rc_index = "AXsh:rexx/rc.index"
- var_val=""; var_file=""; var_defval="";
-
- parse upper arg var_name
- if left(var_name,1) ~= '%' then var_name = '%'var_name
- if right(var_name,1) ~= ':' then var_name = var_name':'
-
- if open('idx',rc_index,'Read') then do
- do until (eof('idx') | (var_file~=''))
- str= translate(readln('idx'),' ',d2c(9))
- if words(str) > 0 then do
- parse var str vname ' ' fname '"' defval '"'
- if upper(vname) = var_name then do
- var_file= strip(fname,'B',' 'd2c(9))
- var_defval= defval
- end
- end
- end
- call close('idx')
- end
- else say 'Could not read "'rc_index'"'
-
- if words(var_file) > 0 then do
- if open('rc',var_file,'Read') then do
- do until (eof('rc') | (var_val~=''))
- str= translate(readln('rc'),' ',d2c(9))
- if upper(word(str,1)) = var_name then var_val = strip(readln('rc'),'B',' 'd2c(9))
- end
- call close('rc')
- end
- else say 'Could not examine "'var_file'" for' var_name
- end
- else do
- if words(var_defval) > 0 then var_val= var_defval
- else say 'No such config variable:' var_name
- end
-
- return var_val
-
-